<template>
  <div class="login">
    <form @submit.prevent="toLogin">
        <h3>登录</h3>
        <div>
            <label for="name">用户名：</label>
            <input type="text" name="" id="name" v-model="name">
        </div>
        <div>
            <label for="password">密码：</label>
            <input type="password" name="" id="password" v-model="password">
        </div>
        <button>登录</button>
    </form>
  </div>
</template>
<script>
export default {
    data(){
        return{
            name:"",
            password:""
        }
    },
    methods:{
        toLogin(){
            localStorage.setItem("usr",this.name);
            this.$router.push("/");
        }
    },
    
}
</script>